package com.za.wbw.web.shop.action;

import java.util.Map;

import org.apache.log4j.Logger;

import sun.util.logging.resources.logging;

import com.za.wbw.model.shop.ShopInfo;
import com.za.wbw.model.shop.UserInfo;
import com.za.wbw.service.shop.ShopService;
import com.za.wbw.service.shop.UserService;
import com.za.wbw.util.BaseAction;

public class UserAction  extends BaseAction {
	public static Logger logger = Logger.getLogger(UserAction.class);
	private static final long serialVersionUID = 1L;
	
	private UserService userService;
	private ShopService shopService;

	public String queryUserInfo() throws Exception{
		Map<String,Object> _info = (Map<String,Object>)request.getSession().getAttribute("_info");
		// 用户信息
		int userId = (Integer)_info.get("user_id");
		UserInfo user = getUserService().queryUserInfo(userId);
		request.setAttribute("user", user);
		// 店铺信息
		Object shopId = (Integer)_info.get("shop_id");
		if(shopId!=null){
			ShopInfo shop = getShopService().queryShopInfo((Integer)shopId);
			request.setAttribute("shop", shop);
		}
		return SUCCESS;
	}
	public String preUpdateUserInfo() throws Exception{
		return SUCCESS;
	}
	public String updateUserInfo() throws Exception{
		return SUCCESS;
	}
	// -----------------------------
	public UserService getUserService() {
		return userService;
	}
	public void setUserService(UserService userService) {
		this.userService = userService;
	}
	public ShopService getShopService() {
		return shopService;
	}
	public void setShopService(ShopService shopService) {
		this.shopService = shopService;
	}
}
